jQuery Traversing - parentsUtil
$('h2').parentsUntil('div').css("border","2px solid red");
Reset
div element
ul element
li element
h2 element
li element